import dht
import machine
import modular_i2c


# 接线
# VCC   -> 3v
# GND   -> g
# DATA  -> pin4 = d2

def get_current_context():
    modular_i2c.show_loading()
    d = dht.DHT11(machine.Pin(14))
    d.measure()
    # d.temperature() # eg. 23 (°C)
    # d.humidity()    # eg. 41 (% RH)
    temperature = d.temperature()
    humidity = d.humidity()
    result = {
        "temperature": temperature,
        "humidity": humidity
    }
    modular_i2c.show_oled(result)
